from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys

driver = webdriver.Edge()

# 键盘事件
keys = driver.find_element(By.ID,'a')
# 1 回车事件
keys.send_keys(Keys.ENTER)
# 2 ctrl事件
keys.send_keys(Keys.CONTROL)
# 3 shift事件 shift+’1‘
keys.send_keys(Keys.SHIFT,'1')
# 4 空格事件
keys.send_keys(Keys.SPACE)
# 5 退格事件
keys.send_keys(Keys.BACKSPACE)
# 6 delete事件
keys.send_keys(Keys.DELETE)
# 7 alt事件
keys.send_keys(Keys.ALT)
# 8 tab事件
keys.send_keys(Keys.TAB)
# 9 上下左右
keys.send_keys(Keys.UP)
keys.send_keys(Keys.DOWN)
keys.send_keys(Keys.LEFT)
keys.send_keys(Keys.RIGHT)
